package com.yuke.cloud.service.cmc.controller.frontend;

import com.yuke.cloud.service.cmc.entity.CmsHotWord;
import com.yuke.cloud.service.cmc.service.CmsHotWordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@Api(value = "WEB - CmsHotWordController", tags = "处理CmsHotWord相关请求", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@RestController
@RequestMapping("/mall/cms/hot_word")
public class CmsHotWordForApp {
    @Resource
    private CmsHotWordService cmsHotWordService;
    //for app
    @GetMapping("/hotWord")
    @ApiOperation(httpMethod = "GET", value = "分页获取所有记录")
    public List<CmsHotWord> list2(@RequestParam("searchType") int searchType){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date = new Date();
        String format = simpleDateFormat.format(date);
        List<CmsHotWord> list=cmsHotWordService.finit(format,searchType);
        return list;
    }
}
